@model ZKEACMS.Common.Models.ImageWidget
<div class="widget-image">
    @if (Model.Link.IsNullOrEmpty())
    {
        <picture>
            @if (Model.ImageUrlSm.IsNotNullAndWhiteSpace())
            {
                <source srcset="@Url.PathContent(Model.ImageUrlSm)" media="(max-width: 767px)">
            }
            @if (Model.ImageUrlMd.IsNotNullAndWhiteSpace())
            {
                <source srcset="@Url.PathContent(Model.ImageUrlMd)" media="(max-width: 991px)">
            }
            <img alt="@Model.AltText"
                 src="@Url.PathContent(Model.ImageUrl)"
                 style="object-fit:cover;@(Model.Width.HasValue ? $"width:{Model.Width}px;" : string.Empty)@(Model.Height.HasValue ? $"height:{Model.Height}px;" : string.Empty)" />
        </picture>
    }
    else
    {
        <a href="@Url.Content(Model.Link)" target="@Html.SmartLinkTarget(Model.Link)">
            <picture>
                @if (Model.ImageUrlSm.IsNotNullAndWhiteSpace())
                {
                    <source srcset="@Url.PathContent(Model.ImageUrlSm)" media="(max-width: 767px)">
                }
                @if (Model.ImageUrlMd.IsNotNullAndWhiteSpace())
                {
                    <source srcset="@Url.PathContent(Model.ImageUrlMd)" media="(max-width: 991px)">
                }
                <img alt="@Model.AltText"
                     src="@Url.PathContent(Model.ImageUrl)"
                     style="object-fit:cover;@(Model.Width.HasValue ? $"width:{Model.Width}px;" : string.Empty)@(Model.Height.HasValue ? $"height:{Model.Height}px;" : string.Empty)" />
            </picture>
        </a>
    }
</div>